package nyasatech.elevatorsim;

import java.util.ArrayList;

public class Elevator {

	//keeps the name this elevator
	private String name;

	//passengers in the elevator
	private ArrayList<Passenger> passengerList = new ArrayList<Passenger> ();

	//constructor
	public Elevator( String nameInput )
	{
		this.name = nameInput;

	}

	//gets size of the array list
	public int getSize()
	{
		return this.passengerList.size();
	}

	//shows the status of the passengers
	public void showPassengerSummary()
	{
		System.out.println("_______________");
		for(Passenger passenger : this.passengerList )
		{
			System.out.println(passenger);
		}
		System.out.println("_______________");
	}

	//adds passengers to the elevator
	public void addPassenger()
	{
		this.passengerList.add(new Passenger());
	}

	//remove a passenger from the elevator
	public void removePassenger(int inputId)
	{
		for(int i = 0; i<this.passengerList.size(); i++)
		{
			int currentPasId = this.passengerList.get(i).getId();
			if(currentPasId == inputId)
			{
				this.passengerList.remove(i);
			}
		}
	}

	//shows the representation of this elevator
	public String toString()
	{
		return this.name + ": "  + getSize() ;
	}

}
